function dateAdd(date, strInterval, Number) {  //参数分别为日期对象，增加的类型，增加的数量 
	var dtTmp = date;  
	switch (strInterval) {   
		case 'second':
		case 's' :
			return new Date(Date.parse(dtTmp) + (1000 * Number));  
		case 'minute':
		case 'n' :
			return new Date(Date.parse(dtTmp) + (60000 * Number));  
		case 'hour':
		case 'h' :
			return new Date(Date.parse(dtTmp) + (3600000 * Number)); 
		case 'day':                           
		case 'd' :
			return new Date(Date.parse(dtTmp) + (86400000 * Number)); 
		case 'week':                           
		case 'w' :
			return new Date(Date.parse(dtTmp) + ((86400000 * 7) * Number));
		case 'month':
		case 'm' :
			return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());  
		case 'year':
		case 'y' :
			return new Date((dtTmp.getFullYear() + Number), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());  
	}
}

//计算天数差的函数，通用  
function DateDiff(sDate1, sDate2) {    //sDate1和sDate2是2006-12-18格式
   var oDate1 = new Date(sDate1.replace(/-/g, "/"));
   var oDate2 = new Date(sDate2.replace(/-/g, "/"));
   var dateDiff = oDate1.getTime() - oDate2.getTime();
   var dayNum = parseInt(dateDiff / (1000 * 60 * 60 * 24));  
   return dayNum;
}

function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
}

function getStandardMonth(year, month) {
	if(parseInt(month)<10) {
		month = '0' + month;
	}
	
	return year+'-'+month;
}

function getStandardDay(year, month, day) {
	if(parseInt(day)<10) {
		day = '0' + day;
	}
	
	return getStandardMonth(year, month)+'-'+day;
}